package gulimall.threadReview;

import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;

/**
 * 线程池测试
 *
 * @author HLF
 * @date 2022/7/22 21:31
 */
public class ThreadPoolTest {
    private static ExecutorService service = Executors.newFixedThreadPool(10);//创建一个含有10个线程的线程池

    public static void main(String[] args) throws ExecutionException, InterruptedException {
        Future<Integer> future = service.submit(() -> 1 + 2);//自动开启线程

        System.out.println(future.get());

    }
}
